﻿CREATE PROCEDURE [Users_insert]
	@P_1 Int,
	@P_2 NVarChar(50),
	@P_3 NVarChar(50),
	@P_4 NVarChar(max),
	@P_5 DateTime,
	@P_6 Int,
	@P_7 Bit,
	@P_8 Bit,
	@P_9 DateTime,
	@P_10 NVarChar(50),
	@P_11 DateTime,
	@P_12 NVarChar(max),
	@P_13 Int,
	@sync_row_count Int OUTPUT
AS
BEGIN
SET @sync_row_count = 0; IF NOT EXISTS (SELECT * FROM [Users_tracking] WHERE [UserID] = @P_1) BEGIN INSERT INTO [Users]([UserID], [Username], [Email], [AccessToken], [Expires], [RoleID], [UserActivated], [UserBlocked], [DateTimeStamp], [Locale], [DateTimeUpdated], [SessionKey], [Version]) VALUES (@P_1, @P_2, @P_3, @P_4, @P_5, @P_6, @P_7, @P_8, @P_9, @P_10, @P_11, @P_12, @P_13);  SET @sync_row_count = @@rowcount;  END 
END